{include file="public/header"}
<body>
<fieldset class="layui-elem-field">
    <div class="layui-field-box">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 管理员名称</label>
                <div class="layui-input-block">
                    <input type="text" name="name" required value="" lay-verify="required" placeholder="请输入姓名" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 登录手机号</label>
                <div class="layui-input-block">
                    <input type="text" name="mobile" required value="" lay-verify="required" placeholder="请输入登录用的手机号" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span style="color:red">*</span> 密码</label>
                <div class="layui-input-block">
                    <input type="text" name="pwd" required value="" lay-verify="required" placeholder="请输入密码" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="admin-form">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</fieldset>


{include file="public/footer"}

<script>
    layui.use('form', function(){
        var form = layui.form();
        form.on('submit(admin-form)', function(data){
            $.ajax({
                type: "POST",
                url: '{:url("add")}',
                data: data.field,
                success: function(msg){
                    if( msg.errorCode == 0 ){
                        layer.msg(msg.msg,{time:1800},function(){
                            parent.location.reload();
                        });
                    }else{
                        parent.layer.msg(msg.msg, {
                            icon: 5,
                            shade: [0.6, '#393D49'],
                            time:1500
                        });
                    }
                }
            });
            return false;
        });

    });
</script>
</body>
</html>